<template>
  <main-wrap class="mywrapper">
    <div class="weui-cells__title">维修项列表</div>
    <div class="weui-cells weui-cells_checkbox">
        <label class="weui-cell weui-check__label" v-for="(item, index) in mrolist" :key="item.id" :for="'x' + index" @click="goselect(item.id, item.text)">
            <div class="weui-cell__hd">
                <input type="checkbox" class="weui-check" name="checkbox1" :id="'x' + index">
                <i class="weui-icon-checked"></i>
            </div>
            <div class="weui-cell__bd">
                <p>{{item.text}}</p>
            </div>
        </label>
    </div>
    <!-- <div class="weui-cells weui-cells_radio">
        <label class="weui-cell weui-check__label" v-for="item in mrolist" :key="item.id" :for="'x' + item.id" @click="goselect(item.id)">
            <div class="weui-cell__bd">
                <p>{{item.text}}</p>
            </div>
            <div class="weui-cell__ft">
                <input type="radio" class="weui-check" name="radio1" :id="'x' + item.id">
                <span class="weui-icon-checked"></span>
            </div>
        </label>
    </div> -->
  </main-wrap>
</template>

<script>
import MainWrap from '@/components/mainWrap'
export default {
  name: 'MroList',
  components: {
    MainWrap
  },
  data () {
    return {
      mrolist: []
    }
  },
  mounted () {
    this.cm.overscroll(document.querySelector('.mywrapper'))
    this.getRepairItem()
  },
  methods: {
    getRepairItem () {
      this.cm.myajax('sys/userrepair/repairItemList', {}, (data) => {
        data = data.repairItemList
        for (let i = 0; i < data.length; i++) {
          let ele = data[i]
          this.mrolist.push({
            id: ele.repairItemId,
            text: ele.itemName
          })
        }
      })
    },
    goselect (rid, rtext) {
      setTimeout(() => {
        localStorage.mrotype = rtext
        localStorage.mrotypeID = rid
        this.$router.push('/mreport')
      }, 500)
    }
  }
}
</script>

<style lang="stylus" scoped>

</style>
